package io.renren.modules.sys.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.sys.dao.CustomerLogDao;
import io.renren.modules.sys.entity.CustomerLogEntity;
import io.renren.modules.sys.service.CustomerLogService;


@Service("customerLogService")
public class CustomerLogServiceImpl extends ServiceImpl<CustomerLogDao, CustomerLogEntity> implements CustomerLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
    	Integer customerId=null;
    	if(null!=params.get("customerId")&&!StringUtils.isEmpty(params.get("customerId").toString())) {
    		customerId=Integer.valueOf(params.get("customerId").toString());
    	}
        Page<CustomerLogEntity> page = this.selectPage(
                new Query<CustomerLogEntity>(params).getPage(),
                new EntityWrapper<CustomerLogEntity>()
                .addFilterIfNeed(null!=customerId, "customer_id={0}", customerId)
                .orderBy("id", false)
        );

        return new PageUtils(page);
    }

}
